<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">
    {{-- 默认使用谷歌浏览器内核--}}
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">

    <title>@if(! empty($header))
            {{ $header }} |
        @endif {{ Dcat\Admin\Admin::title() }}</title>

    @if(! config('admin.disable_no_referrer_meta'))
        <meta name="referrer" content="no-referrer"/>
    @endif

    @if(! empty($favicon = Dcat\Admin\Admin::favicon()))
        <link rel="shortcut icon" href="{{ $favicon }}">
    @endif

    {!! admin_section(Dcat\Admin\Admin::SECTION['HEAD']) !!}

    {!! Dcat\Admin\Admin::asset()->headerJsToHtml() !!}

    {!! Dcat\Admin\Admin::asset()->cssToHtml() !!}
</head>

<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h5 class="mb-0">人员来访记录</h5>
                </div>
                <div class="card-body">
                    <!-- 搜索表单 -->
                    <form method="GET" action="{{ route('visitors','select') }}" class="mb-4">
                        <div class="row">
                            <div class="col-md-3">
                                <input type="text" name="name" class="form-control" placeholder="来访人姓名"
                                       value="{{ request('name') }}">
                            </div>
                            <div class="col-md-3">
                                <input type="text" name="departure_date" class="form-control" placeholder="抵达日期"
                                       value="{{ request('departure_date') }}">
                            </div>

                            <div class="col-md-3">
                                <button type="submit" class="btn btn-primary">搜索</button>
                                <a href="{{ route('visitors') }}" class="btn btn-secondary">重置</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="table-wrap table-main" data-height="" style="max-height: 600px;">

    <table class="custom-data-table table custom-data-table data-table table-text-center table-bordered complex-headers" id="grid-table">
        <thead>
        <tr>
            <th>ID</th>
            <th>来访人</th>
            <th>性别</th>
            <th>身份证</th>
            <th>出发城市</th>
            <th>出发日期</th>
            <th>抵达日期</th>
            <th>交通工具</th>
            <th>落脚城市</th>
            <th>班机号码</th>
            <th>是否住宿</th>
            <th>房间类型</th>
            <th>邀请人</th>
            <th>所属区域</th>

        </tr>
        </thead>
        <tbody>
        @forelse ($visitors as $visitor)
            <tr>
                <td>{{ $visitor['id'] }}</td>
                <td>{{ $visitor['name'] }}</td>
                <td>{{ $visitor['gender'] }}</td>
                <td>{{ $visitor['id_card'] }}</td>
                <td>{{ $visitor['departure_city'] }}</td>
                <td>{{ $visitor['departure_date'] }}</td>
                <td>{{ $visitor['arrival_date'] }}</td>
                <td>{{ $visitor['transport'] }}</td>
                <td>{{ $visitor['arrival_city'] }}</td>
                <td>{{ $visitor['flight_number'] }}</td>
                <td>{{ $visitor['is_accommodation']?'是':'否' }}</td>
                <td>{{ $visitor['room_type'] }}</td>
                <td>{{ $visitor['inviter'] }}</td>
                <td>{{ $visitor['region'] }}</td>

                {{--                                        <td>--}}
                {{--                                        <span class="badge badge-{{ $visitor->status_badge }}">--}}
                {{--                                            {{ $visitor->status_text }}--}}
                {{--                                        </span>--}}
                {{--                                        </td>--}}
                {{--                                        <td>--}}
                {{--                                            <a href="{{ route('visitors.show', $visitor->id) }}" class="btn btn-sm btn-info" title="查看">--}}
                {{--                                                <i class="fas fa-eye"></i>--}}
                {{--                                            </a>--}}
                {{--                                            <a href="{{ route('visitors.edit', $visitor->id) }}" class="btn btn-sm btn-primary" title="编辑">--}}
                {{--                                                <i class="fas fa-edit"></i>--}}
                {{--                                            </a>--}}
                {{--                                            <form action="{{ route('visitors.destroy', $visitor->id) }}" method="POST" style="display: inline-block;">--}}
                {{--                                                @csrf--}}
                {{--                                                @method('DELETE')--}}
                {{--                                                <button type="submit" class="btn btn-sm btn-danger" title="删除" onclick="return confirm('确定删除此记录吗？')">--}}
                {{--                                                    <i class="fas fa-trash"></i>--}}
                {{--                                                </button>--}}
                {{--                                            </form>--}}
                {{--                                        </td>--}}
            </tr>
        @empty
            <tr>
                <td colspan="8" class="text-center">暂无来访记录</td>
            </tr>
        @endforelse
        </tbody>
    </table>
    <div class="d-flex justify-content-center mt-4">
        {{ $visitors->appends(request()->query())->links('bootstrap-4') }}
    </div>
</div>


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<style>

</style>

